function checkAttributes() {
	var status = $("[id='stock_req_form:status']").val();
	if (status == 'Entering' || status == '') {
		$(".disabled_input").removeAttr("disabled");
	} else {
		$(".disabled_input").attr("disabled", "true");
	}

	if (status == '') {
		disableFunctionButtons();
		$("[id='stock_req_form:save_btn']").removeClass("disable_btn");
		$("[id='stock_req_form:add_items_btn']").removeClass("disable_btn");
		$(".disabled_input").removeAttr("disabled");
		
		disableFields();
		$("[id='stock_req_form:officer_code_btn']").removeAttr("disabled");
		$("[id='stock_req_form:store_code_btn']").removeAttr("disabled");
		$("[id='stock_req_form:transaction_code_btn']").removeAttr("disabled");
		$("[id='stock_req_form:postage']").removeAttr("disabled");
		
	}
	if (status == 'Entering') {
		disableFunctionButtons();
		$("[id='stock_req_form:save_btn']").removeClass("disable_btn");
		$("[id='stock_req_form:complete_btn']").removeClass("disable_btn");
		$("[id='stock_req_form:cancel_btn']").removeClass("disable_btn");
		$("[id='stock_req_form:add_items_btn']").removeClass("disable_btn");
		$(".disabled_input").removeAttr("disabled");
		
		disableFields();
		$("[id='stock_req_form:officer_code_btn']").removeAttr("disabled");
		$("[id='stock_req_form:store_code_btn']").removeAttr("disabled");
		$("[id='stock_req_form:postage']").removeAttr("disabled");
	}
	if (status == 'Posted') {
		disableFunctionButtons();
		$("[id='stock_req_form:save_btn']").removeClass("disable_btn");
		$("[id='stock_req_form:finalise_btn']").removeClass("disable_btn");
		$("[id='stock_req_form:cancel_btn']").removeClass("disable_btn");
		
		disableFields();
		$("[id='stock_req_form:store_code_btn']").removeAttr("disabled");
		$("[id='stock_req_form:postage']").removeAttr("disabled");
	}
	if (status == 'Received') {
		disableFunctionButtons();
		//$("[id='stock_req_form:save_btn']").removeClass("disable_btn");
		//$("[id='stock_req_form:cancel_btn']").removeClass("disable_btn");
		
		disableFields();
		//$("[id='stock_req_form:store_code_btn']").removeAttr("disabled");
		//$("[id='stock_req_form:postage']").removeAttr("disabled");
	}
	if (status == 'Cancelled') {
		disableFunctionButtons();
		disableFields();
	}
}

function disableFunctionButtons()
{
	$("[id='stock_req_form:save_btn']").addClass("disable_btn");
	$("[id='stock_req_form:complete_btn']").addClass("disable_btn");
	$("[id='stock_req_form:finalise_btn']").addClass("disable_btn");
	$("[id='stock_req_form:cancel_btn']").addClass("disable_btn");
	$("[id='stock_req_form:add_items_btn']").addClass("disable_btn");
	$(".disabled_input").attr("disabled", "true");
}


function disableFields()
{
	$("[id='stock_req_form:requisition_no']").attr("disabled", "true");
	$("[id='stock_req_form:officer_code_btn']").attr("disabled", "true");
	$("[id='stock_req_form:officer_code']").attr("disabled", "true");
	$("[id='stock_req_form:store_code_btn']").attr("disabled", "true");
	$("[id='stock_req_form:store_code']").attr("disabled", "true");
	$("[id='stock_req_form:transaction_code_btn']").attr("disabled", "true");
	$("[id='stock_req_form:transaction_code']").attr("disabled", "true");
	$("[id='stock_req_form:transaction_date']").attr("disabled", "true");
	$("[id='stock_req_form:postage']").attr("disabled", "true");
	$("[id='stock_req_form:status']").attr("disabled", "true");
	//$("[id='stock_req_form:comment']").attr("disabled", "true");

}

function finaliseBtnOnclick() {
	var postage = $("[id='stock_req_form:postage']").val();
	if (postage <= 0) {
		alert("Postage: "
				+ postage
				+ " is negative or zeor, please specify a postive value for postage");
		return false;
	} else {
		return true;
	}

}

function cancelBtnOnclick() {
	return true;
}
